package com.zf.dtp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class ThreadPoolExecutorConfig {

    @Bean("threadPoolExecutor_1")
    public ThreadPoolExecutor threadPoolExecutor1() {
        return new ThreadPoolExecutor(2, 50, 10000, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100));
    }

    @Bean("threadPoolExecutor_2")
    public ThreadPoolExecutor threadPoolExecutor2() {
        return new ThreadPoolExecutor(10, 100, 10000, TimeUnit.SECONDS, new LinkedBlockingQueue<>(100));
    }


}
